--
-- Created by IntelliJ IDEA.
-- User: yangcb
-- Date: 2017/10/9
-- Time: 15:03
-- To change this template use File | Settings | File Templates.
--

local stock = redis.call('get', 'stock');
if tonumber(stock) >= 1 then
    redis.call("incrby", 'stock', -1);
    return 1;
end
return nil;

